package com.ktjiaoyu.crm.base.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {
    private String[] excludePathPatterns;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        String[] pathPatterns = {"/**"}; //拦截路径规则
        String[] excludePathPatterns = {"/","/login","/doLogin","/css/**", "/fonts/**", "/images/**", "/js/**","/localcss/**","/localjs/**"}; //添加排除路径规则
        registry.addInterceptor(new AuthorizationInterceptor()).addPathPatterns(pathPatterns).excludePathPatterns(excludePathPatterns); //添加排除路径规则
    }
}
